import React from "react";
import Site from "./site";

class App extends React.Component{

    constructor(props) {
        super(props);
        console.log("header.js",props);

        this.state = {
            time: new Date().toLocaleString(),
        }
    }

    render() {
        return (
            <div className={"headerApp"}>
                这是头部<span className={"website"}>
                {this.state.time}
                &nbsp;&nbsp;
                <button onClick={
                    event => {
                        console.log(event);
                        this.setState({
                            time: new Date().toLocaleString()
                        })
                    }
                }>点击更新时间</button>
                <br/>
                main传递过来的num值：{this.props.num}
                <br/>
                <Site num={this.props.num}/>
                </span>
            </div>
        )
    }

}

export default App;

